RtEnablePortIo

RtEnablePortIo enables direct I/O port access from user context.

Syntax

BOOL RtEnablePortIo(
   PUCHAR StartPort,
   ULONG nNumberOfBytes
);

Parameters

StartPort

The first port to have direct I/O permissions enabled by this call. Each I/O space address points at a single byte. For ports that represent 2-byte or 4-byte locations, the appropriate number of I/O space addresses must be enabled or an exception will be encountered.

nNumberOfBytes

An unsigned 32-bit integer indicating the number of addresses/bytes to enable, starting at StartPort.

Return Values

TRUE if the function completes successfully, FALSE if invalid parameters are specified

Remarks

This function currently has no impact on RTSS determinism. This call is a NO-OP (no operation) when issued from RTSS applications.

RtEnablePortIo enables direct user access to the specified range of I/O addresses. On the Pentium processor, there are 216-1 = 65,535 byte-wide I/O port addresses. Two-byte word and four-byte double word ports take two and four I/O port addresses, respectively, and fall on even word and long word addresses (i.e., divisible by two and four), respectively.

The address for which direct I/O is to be enabled is passed in StartPort, cast as a pointer to an unsigned character (i.e., a single-byte quantum). Generally, this address represents a hardware register or port, so only a single byte needs to be enabled (i.e., nNumberOfBytes is set to 1). If the location represents a two-byte word or four-byte double word port, then the parameter nNumberOfBytes should reflect the width of the I/O port. Note that nNumberOfBytes can also be used to enable permission for an entire range of addresses, independent of their data widths.

Requirements

Header Rtapi.h
Library rtapi_w32.lib (Windows), Rtx_Rtss.lib (RTSS)

See Also:

RtDisablePortIo

RtReadPortBuffer* (Uchar, Ushort, Ulong)

RtReadPort* (Uchar, Ushort, Ulong)

RtWritePortBuffer* (Uchar, Ushort, Ulong)

RtWritePort* (Uchar, Ushort, Ulong)

IntervalZero.com | Support | Give Feedback